<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Preloading data into the file system cache | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'preload-data-to-file-system-cache.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/preload-data-to-file-system-cache.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/preload-data-to-file-system-cache.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/preload-data-to-file-system-cache.html" rel="nofollow" target="_blank">../en/preload-data-to-file-system-cache.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="index-modules.html">Index modules</a></span>
»
<span class="breadcrumb-link"><a href="index-modules-store.html">Store</a></span>
»
<span class="breadcrumb-node">Preloading data into the file system cache</span>
</div>
<div class="navheader">
<span class="prev">
<a href="index-modules-store.html">« Store</a>
</span>
<span class="next">
<a href="index-modules-translog.html">Translog »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="preload-data-to-file-system-cache"></a>Preloading data into the file system cache<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules/store.asciidoc">edit</a>
</h2>
</div></div></div>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>This is an expert setting, the details of which may change in the future.</p>
</div>
</div>
<p>By default, Elasticsearch completely relies on the operating system file system
cache for caching I/O operations. It is possible to set <code class="literal">index.store.preload</code>
in order to tell the operating system to load the content of hot index
files into memory upon opening. This setting accept a comma-separated list of
files extensions: all files whose extension is in the list will be pre-loaded
upon opening. This can be useful to improve search performance of an index,
especially when the host operating system is restarted, since this causes the
file system cache to be trashed. However note that this may slow down the
opening of indices, as they will only become available after data have been
loaded into physical memory.</p>
<p>This setting is best-effort only and may not work at all depending on the store
type and host operating system.</p>
<p>The <code class="literal">index.store.preload</code> is a static setting that can either be set in the
<code class="literal">config/elasticsearch.yml</code>:</p>
<div class="pre_wrapper lang-yaml">
<pre class="programlisting prettyprint lang-yaml">index.store.preload: ["nvd", "dvd"]</pre>
</div>
<p>or in the index settings at index creation time:</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT /my_index
{
  "settings": {
    "index.store.preload": ["nvd", "dvd"]
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1046.console"></div>
<p>The default value is the empty array, which means that nothing will be loaded
into the file-system cache eagerly. For indices that are actively searched,
you might want to set it to <code class="literal">["nvd", "dvd"]</code>, which will cause norms and doc
values to be loaded eagerly into physical memory. These are the two first
extensions to look at since Elasticsearch performs random access on them.</p>
<p>A wildcard can be used in order to indicate that all files should be preloaded:
<code class="literal">index.store.preload: ["*"]</code>. Note however that it is generally not useful to
load all files into memory, in particular those for stored fields and term
vectors, so a better option might be to set it to
<code class="literal">["nvd", "dvd", "tim", "doc", "dim"]</code>, which will preload norms, doc values,
terms dictionaries, postings lists and points, which are the most important
parts of the index for search and aggregations.</p>
<p>Note that this setting can be dangerous on indices that are larger than the size
of the main memory of the host, as it would cause the filesystem cache to be
trashed upon reopens after large merges, which would make indexing and searching
<em>slower</em>.</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="index-modules-store.html">« Store</a>
</span>
<span class="next">
<a href="index-modules-translog.html">Translog »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>